#include <iostream>
#include <unistd.h>
#include "pthread.hpp"
#include "Task.hpp"
#include "ThreadPool.hpp"
#include"Log.hpp"

// 主线程负责创建与启动线程池，最终关闭线程池
int main()
{
    srand(time(nullptr));
    threadpool<Task>::GetInstance();
    EnableFile();

    int cnt = 10;
    while (cnt--)
    {
        int a = rand() % 100;
        int b = rand() % 100;
        threadpool<Task>::GetInstance()->enqueue(Task(a, b));
    }
    sleep(3);
    threadpool<Task>::GetInstance()->Stop();
    threadpool<Task>::GetInstance()->WaitAll();
    return 0;
}